<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableform" >
<tbody>
  <tr>
    <th><em class="c-red">*</em><{t}>收货地区：<{/t}></td>
    <td colspan=2>
      <span id="checkout-select-area"><{input type="region" id="shipping-area" name="delivery[ship_area]" app="ectools" vtype="area" value=$addr.area}></span>
    </td>
  </tr>
  <tr>
    <th><em class="c-red">*</em><{t}>收货地址：<{/t}></td>
    <td>
    <input type='hidden' name='delivery[ship_addr_area]' value='' id='selected-area-hidden'/>    
    <span id='selected-area' class='fontcolorGray' title='<{t}>系统将拼接地区选择结果到收获地址<{/t}>'><{t}>[地区]<{/t}></span>
    <{input class="inputstyle" name="delivery[ship_addr]"   id="addr" vtype="required" value=$addr.addr size="50"}>
    </td>
  </tr>
  <tr>
   <th>
	<{t}>邮编：<{/t}></th>
    <td>
	<{input class="inputstyle" name="delivery[ship_zip]" size="15" id="zip"  type="text" value=$addr.zipcode}>
	</td>
  </tr>
  <tr>
    <th><em class="c-red">*</em><{t}>收货人姓名：<{/t}></td>
    <td colspan=2><{input class="inputstyle" name="delivery[ship_name]" size="15" id="name" vtype="required"  type="text" value=$addr.name}></td>
  </tr>
  <{if !$address.member_id}>
  <tr>
    <th><em class="c-red">*</em><{t}>Email：<{/t}></td>
    <td colspan=2><{input name="delivery[ship_email]" class="inputstyle" id="ship_email"  size="15" type="text" vtype="email" value=$addr.email}></td>
  </tr>
  <{/if}>
  <tr>
    <th>
      <em class="c-red">*</em><{t}>手机：<{/t}>
    </td>
    <td colspan=2>
     <{input class="inputstyle" name="delivery[ship_mobile]" size="15" vtype="digits" type="text" id="mobile" value=$addr.phone.mobile}>
    </td>
  </tr>
  <tr>
    <th>
      <{t}>固定电话：<{/t}>
    </td>
    <td colspan=2>
     <{input class="inputstyle" name="delivery[ship_tel]" size="15" vtype="digits" type="text" id="tel" value=$addr.phone.telephone}>
	 <input type="hidden" vtype="mobile_or_phone" />
    </td>
  </tr>
  <{if !$addr.addr_id && $address.member_id && !$has_last_def_addr}>
  <tr class="recsave">
    <th></th>
    <td colspan=2><label><input name="delivery[is_save]" type="checkbox" checked="checked" value=1><{t}>保存此收货地址<{/t}></label><label>&nbsp;<input name="delivery[is_default]" type="checkbox" value=1><{t}>设为默认地址<{/t}></label></td>
	<script>
		$E('input[name^=delivery[is_default]').addEvent('click', function(el){
			if ($(el.target).checked){
				$E('input[name^=delivery[is_save]').checked = true;
			}
		});
		$E('input[name^=delivery[is_save]').addEvent('click', function(el){
			if (!$(el.target).checked){
				$E('input[name^=delivery[is_default]').checked = false;
			}
		});
	</script>
  </tr>
  <{/if}>
  </tbody>
</table>
<{$selectArea}>
<script>
window.addEvent('domready',function(){

	$E('#checkout-select-area input[name^=delivery[]').store('onselect',function(sel){
		
        if(!!sel.options[sel.selectedIndex].get('has_c')){
            $('shipping').set('html','<div class="valierror clearfix" style=" padding-left:20px"><{t}>请选择收货地区<{/t}></div>');   
            $('selected-area').set('text','<{t}>[地区]<{/t}>').removeClass('fontcolorBlack').addClass('fontcolorGray');
        }

    });

    $E('#checkout-select-area input[name^=delivery[]').store('lastsel',function(lastselect){
        var areaSels=$ES("#checkout-select-area select");
        var areaSelPrt=areaSels[0].getParent('*[package=mainland]');
        var selected=[];
        areaSels.each(function(s){
           var text = s[s.selectedIndex].text.trim().clean();
           if(['<{t}>北京<{/t}>','<{t}>天津<{/t}>','<{t}>上海<{/t}>','<{t}>重庆<{/t}>'].indexOf(text)>-1)return;
           selected.push(text);
        });
        var selectedV = selected.join('');
        $('selected-area').setText(selectedV).removeClass('fontcolorGray').addClass('fontcolorBlack');
        $('selected-area-hidden').value =  selectedV;
        $('addr').set('value',$('addr').value.replace(selectedV,''));
   //     Order.setShippingFromArea(lastselect);
    });
    var areaSels=$ES("#checkout-select-area select");

    var lastSel=areaSels[areaSels.length-1];
	
	if( lastSel && lastSel.get('value') != '' && lastSel.get('value') != '_NULL_' )
		lastSel.onchange(lastSel,lastSel.value,(areaSels.lengtd-1));
	
});
</script>